# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# from AUR - adjusted to our style
#
# Maintainer: Alejandro Quisbert <alejandropqc at protonmail dot com>
# Maintainer: Ali Molaei <ali dot molaei at protonmail dot com>

pkgname=mongosh
pkgver=2.5.1
pkgrel=1
pkgdesc='An interactive shell to connect with MongoDB with syntax highlighting, autocomplete, contextual help and error messages.'
arch=('x86_64' 'aarch64')
depends=('krb5')
conflicts=('mongosh')
provides=('mongosh')
url='https://github.com/mongodb-js/mongosh.git'
license=('Apache')
_mongosh_dir="$pkgname-$pkgver-linux"

source_x86_64=("https://downloads.mongodb.com/compass/$pkgname-$pkgver-linux-x64.tgz")
source_aarch64=("https://downloads.mongodb.com/compass/$pkgname-$pkgver-linux-arm64.tgz")

sha512sums_x86_64=('fcbb5269730136fd6cf3a82c4db02b9ca0337d405d8a41d287ebac6731b531fce7d0832b6b7d0c03734b5059c8edb663e4d3695e25f0829dd67f41b9f75b0f1d')
sha512sums_aarch64=('9a09a2b162e1357baa59a93f5845b254166ebace484d24256530b6ab160957212fe75919e0fed947b69d59ce92a4f2d008ee2f971bf4e15ecc5d4df5f645cc95')

package() {
	if [ $CARCH = 'x86_64' ]; then
		_arch=x64;
	elif [ $CARCH = 'aarch64' ]; then
		_arch=arm64;
	fi

	install -D "$_mongosh_dir-$_arch/bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -D "$_mongosh_dir-$_arch/bin/mongosh_crypt_v1.so" \
    "$pkgdir/usr/lib/${pkgname}_crypt_v1.so"
	install -Dm 644 "$_mongosh_dir-$_arch/$pkgname.1.gz" \
    "$pkgdir/usr/share/man/man1/$pkgname.1.gz"
}

